package com.icez.designmode

import android.graphics.Color
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import com.icez.calendar_view.CalendarView
import com.icez.calendar_view.Utils

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        val test = findViewById<CalendarView>(R.id.test)
        test.mCalendarViewConfig?.mMaxRangeDayNum = 5
        val mPointColorDatas = HashMap<Long,Int>()
        mPointColorDatas.put(Utils.dateStrToTimestamp("2022-10-01","yyyy-MM-dd"), Color.BLUE)
        test.mCalendarViewConfig?.mPointColorDates = mPointColorDatas

        test.mOnDayItemClickListener = object:CalendarView.OnDayItemClickListener{
            override fun dayItemClick(year: Int, month: Int, day: Int) {
                Log.e("icez","您点击了：${year} - ${month} - ${day}")
            }

        }

        test.mOnDayRangeListener = object:CalendarView.OnDayRangeListener{
            override fun dayRange(starRangeDate: Long, endRangeDate: Long) {
                Log.e("icez","访问：${starRangeDate} - ${endRangeDate}")
            }

        }
    }
}